
**************************************************************
* CROWDFUNDING
* TABLES
* CODE BY: ERIK ANSINK
**************************************************************




* Table 2
use "tempdata/groupproject.dta", clear
preserve
eststo clear
drop if exp==1
replace projectsuccess=0 if projectsuccess==.
gen welfare1=projectsuccess*bonus
collapse (first) treatmentID treatmentdescription (sum) thresholds=projectsuccess groupcontributions welfare=welfare1, by(group)
by treatmentdescription, sort: eststo: quietly estpost summarize thresholds groupcontributions welfare
esttab using tabledata/table2.tex, cells("mean(fmt(a2))") label nonumber noobs collabels(none) mtitles("BEN" "SEED72" "SIA72" "SIX" "SIXSEED78") coeflabels(thresholds "Thresholds reached" groupcontributions "Total contributions" welfare "Individual welfare") booktabs alignment(D{.}{.}{-1}) fragment replace
restore


* Table 3
use "tempdata/group.dta", clear
preserve
eststo clear
drop if exp==1
eststo: quietly regress totalcontributionspergroup ib3.treatmentID subjectspergroup
eststo: quietly regress totalprojectsuccesspergroup ib3.treatmentID subjectspergroup
eststo: quietly regress totalcontributionsprojects12 ib3.treatmentID subjectspergroup
eststo: quietly regress projectsuccess12 ib3.treatmentID subjectspergroup
esttab using tabledata/table3.tex, se label eqlabels(,none) mgroups("All projects" "BEN projects only", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  mtitles("Contributions" "Thresholds" "Contributions" "Thresholds") nobaselevels coeflabels(3.treatmentID BEN 4.treatmentID SEED72 5.treatmentID SIA72 6.treatmentID SIX 7.treatmentID SIXSEED78 subjectspergroup "\# Subjects/group \hspace*{1cm}") star(* 0.10 ** 0.05 *** 0.01) replace booktabs alignment(D{.}{.}{-1}) width(1\textwidth) fragment 
restore


* Table 4
use "tempdata/group.dta", clear
preserve
eststo clear
drop if exp==1
eststo: quietly regress totalcontributionsproject1 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
eststo: quietly regress projectsuccess1 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
eststo: quietly regress totalcontributionsproject5 ib6.treatmentID subjectspergroup if inrange(treatmentID,6,7)
esttab using tabledata/table4.tex, se label eqlabels(,none) mgroups("Project $72_{18}$" "Project $78_{17}$", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  mtitles("Contributions" "Thresholds" "Contributions") nobaselevels order(4.treatmentID 5.treatmentID 7.treatmentID subjectspergroup) coeflabels(3.treatmentID BEN 4.treatmentID SEED72 5.treatmentID SIA72 6.treatmentID SIX 7.treatmentID SIXSEED78 subjectspergroup "\# Subjects/group \hspace*{1cm}") star(* 0.10 ** 0.05 *** 0.01) replace booktabs alignment(D{.}{.}{-1}) fragment substitute(\_ _)
restore


* Table 4A
use "tempdata/group.dta", clear
preserve
eststo clear
drop if exp==1
eststo: quietly regress contributiondiff72 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
eststo: quietly regress thresholddiff72 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
eststo: quietly regress contributiondiff78 ib6.treatmentID subjectspergroup if inrange(treatmentID,6,7)
esttab using tabledata/table4A.tex, se label eqlabels(,none) mgroups("Project $72_{18}$" "Project $78_{17}$", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) mtitles("\shortstack{Contribution-\\difference}" "\shortstack{Threshold-\\difference}" "\shortstack{Contribution-\\difference}") nobaselevels order(4.treatmentID 5.treatmentID 7.treatmentID subjectspergroup) coeflabels(1.treatmentID 72THEN84 2.treatmentID 84THEN72 3.treatmentID BEN 4.treatmentID SEED72 5.treatmentID SIA72 6.treatmentID SIX 7.treatmentID SIXSEED78 8.treatmentID CROWD subjectspergroup "\# Subjects/group \hspace*{1cm}") star(* 0.10 ** 0.05 *** 0.01) replace booktabs alignment(D{.}{.}{-1}) width(1\textwidth) fragment substitute(\_ _)
restore


* Table 4B
use "tempdata/group.dta", clear
preserve
eststo clear
drop if exp==1
eststo: quietly regress contributionratio72 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
eststo: quietly regress thresholdratio72 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
eststo: quietly regress contributionratio78 ib6.treatmentID subjectspergroup if inrange(treatmentID,6,7)
esttab using tabledata/table4B.tex, se label mgroups("Project $72_{18}$" "Project $78_{17}$", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) mtitles("\shortstack{Contribution-\\ratio}" "\shortstack{Threshold-\\ratio}" "\shortstack{Contribution-\\ratio}") nobaselevels order(4.treatmentID 5.treatmentID 7.treatmentID subjectspergroup) coeflabels(1.treatmentID 72THEN84 2.treatmentID 84THEN72 3.treatmentID BEN 4.treatmentID SEED72 5.treatmentID SIA72 6.treatmentID SIX 7.treatmentID SIXSEED78 8.treatmentID CROWD subjectspergroup "\# Subjects/group \hspace*{1cm}") star(* 0.10 ** 0.05 *** 0.01) replace booktabs alignment(D{.}{.}{-1}) width(1\textwidth) fragment substitute(\_ _)
restore


* Table 5
use "tempdata/groupproject.dta", clear
preserve
eststo clear
drop if exp==1
replace projectsuccess=0 if projectsuccess==.
drop if treatmentID==5
gen byte many = 1 if inlist(treatmentID,6,7)
replace many = 0 if many==.
gen byte seed = 1 if inlist(threshold,92,98)
replace seed = 0 if seed==.
gen ratio=bonus/threshold
rename cont5hrs cont
eststo: quietly ivreg2 projectsuccess (cont = many##seed ratio), first robust
rename cont cont5hrs
rename cont10hrs cont
eststo: quietly ivreg2 projectsuccess (cont = many##seed ratio), first robust
rename cont cont10hrs
rename cont15hrs cont
eststo: quietly ivreg2 projectsuccess (cont = many##seed ratio), first robust
rename cont cont15hrs
* output of the second stage
esttab using tabledata/table5a.tex, se label noobs eqlabels(,none) mtitles("First 5 hours" "First 10 hours" "First 15 hours") nobaselevels coeflabels(cont "Instrumented early contributions") star(* 0.10 ** 0.05 *** 0.01) replace booktabs alignment(D{.}{.}{-1}) fragment substitute(\_ _)
eststo clear
quietly ivreg2 projectsuccess (cont5hrs = many##seed ratio), first robust savefirst
eststo: est restore _ivreg2_cont5hrs
quietly ivreg2 projectsuccess (cont10hrs = many##seed ratio), first robust savefirst
eststo: est restore _ivreg2_cont10hrs
quietly ivreg2 projectsuccess (cont15hrs = many##seed ratio), first robust savefirst
eststo: est restore _ivreg2_cont15hrs
* output of the first stage
esttab using tabledata/table5b.tex, se label nonumber eqlabels(,none) mlabels("" "" "",lhs("First-stage (Early contributions):")) mtitles("" "") nobaselevels coeflabels(1.many MANY 1.seed SEED 1.many#1.seed "MANY $\times$ SEED" ratio "bonus/threshold") star(* 0.10 ** 0.05 *** 0.01) replace booktabs alignment(D{.}{.}{-1}) fragment substitute(\_ _)
restore


* Table 6
use "tempdata/group.dta", clear
preserve
eststo clear
drop if exp==0
eststo: quietly regress totalcontributionsproject1 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
eststo: quietly regress projectsuccess1 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
esttab using tabledata/table6.tex, se label eqlabels(,none) mgroups("Project $72_{18}$", pattern(1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) mtitles("Contributions" "Thresholds") nobaselevels coeflabels(3.treatmentID BEN 4.treatmentID SEED72 5.treatmentID SIA72 6.treatmentID SIX 7.treatmentID SIXSEED78 subjectspergroup "\# Subjects/group \hspace*{1cm}") star(* 0.10 ** 0.05 *** 0.01) replace booktabs alignment(D{.}{.}{-1}) fragment substitute(\_ _)
restore


* Table 6A
use "tempdata/group.dta", clear
preserve
eststo clear
drop if exp==0
eststo: quietly regress contributiondiff72 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
eststo: quietly regress thresholddiff72 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
esttab using tabledata/table6A.tex, se label eqlabels(,none) mgroups("Project $72_{18}$", pattern(1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) mtitles("\shortstack{Contribution-\\difference}" "\shortstack{Threshold-\\difference}") nobaselevels coeflabels(1.treatmentID 72THEN84 2.treatmentID 84THEN72 3.treatmentID BEN 4.treatmentID SEED72 5.treatmentID SIA72 6.treatmentID SIX 7.treatmentID SIXSEED78 8.treatmentID CROWD subjectspergroup "\# Subjects/group \hspace*{1cm}") star(* 0.10 ** 0.05 *** 0.01) replace booktabs alignment(D{.}{.}{-1}) width(1\textwidth) fragment substitute(\_ _)
eststo clear
restore


* Table 6B
use "tempdata/group.dta", clear
preserve
eststo clear
drop if exp==0
eststo: quietly regress contributionratio72 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
eststo: quietly regress thresholdratio72 ib3.treatmentID subjectspergroup if inrange(treatmentID,3,5)
esttab using tabledata/table6B.tex, se label mgroups("Project $72_{18}$", pattern(1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) mtitles("\shortstack{Contribution-\\ratio}" "\shortstack{Threshold-\\ratio}") nobaselevels coeflabels(1.treatmentID 72THEN84 2.treatmentID 84THEN72 3.treatmentID BEN 4.treatmentID SEED72 5.treatmentID SIA72 6.treatmentID SIX 7.treatmentID SIXSEED78 8.treatmentID CROWD subjectspergroup "\# Subjects/group \hspace*{1cm}") star(* 0.10 ** 0.05 *** 0.01) replace booktabs alignment(D{.}{.}{-1}) width(1\textwidth) fragment substitute(\_ _)
eststo clear
restore


* Table A1
use "tempdata/participant.dta", clear
preserve
eststo clear
drop if exp==1
* drop the "don't know'" responses
foreach v of var St_persoon_* {
      replace `v' = . if `v' == 6
}
foreach v of var St_spel_* {
      replace `v' = . if `v' == 6
}
* combine the three types of irrational behavior
gen irrational = (morethanbonus == 1 | overcontribution == 1 | could ==1)
* generate summary statistics by irrationality
eststo rational: quietly estpost summarize age edu female income logins St_persoon_1 St_persoon_2 St_persoon_3 St_spel_1 St_spel_2 St_spel_3 St_spel_4 V_spel_1 V_spel_2 V_spel_3 if irrational == 0
eststo irrational: quietly estpost summarize age edu female income logins St_persoon_1 St_persoon_2 St_persoon_3 St_spel_1 St_spel_2 St_spel_3 St_spel_4 V_spel_1 V_spel_2 V_spel_3 if irrational == 1
* add the Mann-Whitney test statistics
quietly ranksum age, by(irrational)
mat p = 2 * normprob(-abs(r(z)))
quietly ranksum edu, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum female, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum income, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum logins, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum St_persoon_1, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum St_persoon_2, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum St_persoon_3, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum St_spel_1, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum St_spel_2, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum St_spel_3, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum St_spel_4, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum V_spel_1, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum V_spel_2, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum V_spel_3, by(irrational)
mat p = p,2 * normprob(-abs(r(z)))
mat colnames p = age edu female income logins St_persoon_1 St_persoon_2 St_persoon_3 St_spel_1 St_spel_2 St_spel_3 St_spel_4 V_spel_1 V_spel_2 V_spel_3
matrix list p
estadd matrix p
esttab rational irrational irrational using tabledata/tableA1.tex,   cells("mean(pattern(1 1 0) fmt(2)) p(pattern(0 0 1) fmt(2))") noobs nonumber mtitles("\shortstack{Rational\\(mean)}" "\shortstack{Irrational\\(mean)}" "\shortstack{Mann-Whitney\\(p-value)}") label  collabels(none) varlabels(, elist(income \hline logins \hline St_persoon_3 \hline St_spel_4 \hline)) booktabs alignment(D{.}{.}{-1}) width(1\textwidth) fragment replace
matrix drop p
restore


* Table B1
use "tempdata/participantproject.dta", clear
preserve
drop if exp==1
collapse (first) logindays, by(participantID)
* number of "0 login days" is the total of 450 subjects minus the total from the below tab
tab logindays
restore


* Table B2
use "tempdata/participantproject.dta", clear
preserve
eststo clear
drop if exp==1
* generate participant-level data
egen groupcontributions = total(contributionssum), by(group projectID)
gen overinvestment = groupcontributions - threshold
gen projectsuccess = 1 if overinvestment >=0
gen projectpayoff = projectsuccess*(bonus-contributionssum)
drop groupcontributions overinvestment projectsuccess
label variable projectpayoff "Per-project payoff"
collapse (first) treatmentID logindays (sum) nucontribution=contributionscount tocontribution=contributionssum projectpayoffall=projectpayoff, by(participantID)
gen payoff = 34 + projectpayoffall
label variable nucontribution `"Times contributed"'
label variable tocontribution `"Total amount contributed"'
label variable payoff `"Total No.\ tokens"'
* generate attrition dummy separating contributionween 1-3 days and 4 days
gen attrition= (logindays<4)
* summary stats by attrition
eststo onethree: quietly estpost summarize nucontribution tocontribution payoff if attrition == 1
eststo four: quietly estpost summarize nucontribution tocontribution payoff if attrition == 0
* add Mann-Whitney test statistics
quietly ranksum nucontribution, by(attrition)
mat p = 2 * normprob(-abs(r(z)))
quietly ranksum tocontribution, by(attrition)
mat p = p,2 * normprob(-abs(r(z)))
quietly ranksum payoff, by(attrition)
mat p = p,2 * normprob(-abs(r(z)))
mat colnames p = nucontribution tocontribution payoff
matrix list p
estadd matrix p
esttab onethree four four using tabledata/tableB2.tex, cells("mean(pattern(1 1 0) fmt(2)) p(pattern(0 0 1) fmt(2))") noobs nonumber mtitles("\shortstack{1-3 Days\\(mean)}" "\shortstack{4 Days\\(mean)}" "\shortstack{Mann-Whitney\\(p-value)}") label collabels(none) fragment replace booktabs alignment(D{.}{.}{-1}) width(1\textwidth)
matrix drop p
restore


clear
